package com.javabasic.algorithm.leetcode;

import java.util.Scanner;

/**
 * @Author xiongmin
 * @ClassName BarnEchoes
 * @Description TODO
 * @Date 2019/8/31 15:41
 * @Version 1.0
 **/
public class BarnEchoes {
    static Scanner cin = new Scanner(System.in);

    static int[][] dp = new int[81][81];
    private static int Max = -1;

    public static void main(String[] args) {
        String str1 = cin.next();
        String str2 = cin.next();
        int len1 = str1.length();
        int len2 = str2.length();

        for (int i = 0; i < len1; i++) {
            for (int j = 0; j < len2; j++) {
                if (str1.charAt(i) == str2.charAt(j)) {
                    dp[i+1][j+1] = dp[i][j] + 1;
                }
                if (dp[i+1][j+1] > Max) {
                    Max = dp[i+1][j+1];
                }
            }
        }

        System.out.println(Max);

    }
}
